/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package mnstudent.presentationlayer.report;

import mnstudent.datatranferobject.FacultyDTO;
import mnstudent.datatranferobject.SemesterDTO;
import mnstudent.datatranferobject.AcademicYearDTO;
import mnstudent.datatranferobject.MajorDTO;
import mnstudent.businessLayer.MajorBLL;
import mnstudent.businessLayer.SemesterBLL;
import mnstudent.businessLayer.AcademicYearBLL;
import mnstudent.businessLayer.StudentBLL;
import mnstudent.businessLayer.FacultyBLL;
import mnstudent.global.DataTable;
import java.awt.*;
import java.util.ArrayList;
import javax.swing.DefaultComboBoxModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import org.jdesktop.swingx.JXSearchField;


/**
 *
 * @author lee
 */
public class rptCurrentTuitionFee extends org.jdesktop.swingx.JXPanel {

    /**
     * Creates new form frmFaculty
     */
    private FacultyBLL m_FacultyBLL;
    private MajorBLL m_MajorBLL;
    private StudentBLL m_StudentBLL;
    private SemesterBLL m_SemesterBLL;
    private AcademicYearBLL m_AcademicYearBLL;
    
    //
    private ArrayList<FacultyDTO> m_listFacultyObj;
    private ArrayList<Object> m_value;
    private ArrayList<MajorDTO> m_listMajorObj;
    private ArrayList<String> m_listStudentObj;
    private ArrayList<SemesterDTO> m_listSemeterObj;
    private ArrayList<AcademicYearDTO> m_listAcademicYearObj;
    
    //
    private FacultyDTO m_objFaculty;
    private MajorDTO m_objMajor;
    private SemesterDTO m_ObjSemeter;
    private AcademicYearDTO m_ObjAcademicYear;
    //
    
    private DefaultTableModel m_Model;
    
    public rptCurrentTuitionFee() {
        initComponents();
        prepare();
    }
    
    private void prepare(){
        m_MajorBLL = new MajorBLL();
        m_StudentBLL = new StudentBLL();
        m_FacultyBLL = new FacultyBLL();
        m_SemesterBLL = new SemesterBLL();
        m_AcademicYearBLL = new AcademicYearBLL();
        //
        bindingDataToComboBox(); 
        //
        jxtabDetails.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent lse) {
                if (!(jxtabDetails.getSelectionModel().isSelectionEmpty())) {
                    if (jxtabDetails.getRowSelectionAllowed() && jxtabDetails.getRowCount() > 0) {
                        ArrayList<Object> _arrObj = new ArrayList<>();
                        if(((SemesterDTO)jxCmbSemester.getSelectedItem()).getNameOfSemester().equals("Tất cả..."))
                            _arrObj.add("");
                        else
                            _arrObj.add(((SemesterDTO)jxCmbSemester.getSelectedItem()).getSemesterID());
                        if(((AcademicYearDTO)jxCmbAcademicYear.getSelectedItem()).getNameOfAcademicYear().equals("Tất cả..."))
                            _arrObj.add("");
                        else
                            _arrObj.add(((AcademicYearDTO)jxCmbAcademicYear.getSelectedItem()).getAcademicYearID());
                        _arrObj.add(jxtabDetails.getValueAt(jxtabDetails.getSelectedRow(), 0));
                        DefaultTableModel _model = (DefaultTableModel)jxTabViewtDetails.getModel();
                        _model.getDataVector().removeAllElements();
                        _model.fireTableDataChanged();
                        DataTable.addRow(m_StudentBLL.GetAllSubjectByRegistrationCoursesID(_arrObj.toArray()), _model);
                        jxTabViewtDetails.setModel(_model);
                    }
                }
            }
        });
    }

    private void bindingDataToComboBox() {
        //Binding data to CmbFaculty
        m_listFacultyObj = new ArrayList<>();
        m_objFaculty = new FacultyDTO("", "Tất cả...");
        m_listFacultyObj.add(m_objFaculty);
        m_listFacultyObj.addAll(m_FacultyBLL.getAllFacultyToArray());
        jxCmbFaculty.setModel(new DefaultComboBoxModel(m_listFacultyObj.toArray()));
        
        //Binding data to JXCombobox CmbAcademicYear
        m_listStudentObj = new ArrayList<>();
        m_listStudentObj.add("Tất cả...");
        m_listStudentObj.addAll(m_StudentBLL.getAllAdmissionYearFromDatabase());
        
        //Binding data to JXCombobox jxCmbMajor
        m_listMajorObj = new ArrayList<>();
        m_objMajor = new MajorDTO("", "Tất cả...");
        m_listMajorObj.add(m_objMajor);
        jxCmbMajor.setModel(new DefaultComboBoxModel(m_listMajorObj.toArray()));
        
        //Binding data to JXCombobox jxCmbSemester
        m_listSemeterObj = new ArrayList<>();
        m_ObjSemeter = new SemesterDTO("", "Tất cả...");
        m_listSemeterObj.add(m_ObjSemeter);
        m_listSemeterObj.addAll(m_SemesterBLL.getAllSemesterToArray());
        jxCmbSemester.setModel(new DefaultComboBoxModel(m_listSemeterObj.toArray()));
        
        //Binding data to JXCombobox jxCmbAcademicYear
        m_listAcademicYearObj = new ArrayList<>();
        m_ObjAcademicYear = new AcademicYearDTO("", "Tất cả...");
        m_listAcademicYearObj.add(m_ObjAcademicYear);
        m_listAcademicYearObj.addAll(m_AcademicYearBLL.getAllAcademicYearToArray());
        jxCmbAcademicYear.setModel(new DefaultComboBoxModel(m_listAcademicYearObj.toArray()));
        
        //Fill data into JXTable
        m_Model = (DefaultTableModel) jxtabDetails.getModel();
        DataTable.addRow(m_StudentBLL.getRegistrationCoursesInforOfStudent(new Object[]{"","","","",null,"",""}), m_Model);
        jxtabDetails.setModel(m_Model);
        //
    }
   
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnGrp = new javax.swing.ButtonGroup();
        jxpanDetails = new org.jdesktop.swingx.JXPanel();
        jpanTableDetails = new javax.swing.JPanel();
        jpanContent = new javax.swing.JPanel();
        jxpanFindNavibar = new org.jdesktop.swingx.JXPanel();
        jxSearchStudents = new org.jdesktop.swingx.JXSearchField();
        jxLbSearch = new org.jdesktop.swingx.JXLabel();
        jxCmbAcademicYear = new org.jdesktop.swingx.JXComboBox();
        jxCmbSemester = new org.jdesktop.swingx.JXComboBox();
        jxLbSemester = new org.jdesktop.swingx.JXLabel();
        jxLabAcademicYear = new org.jdesktop.swingx.JXLabel();
        jPanel1 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane = new javax.swing.JScrollPane();
        jxtabDetails = new mnstudent.global.MyTable(){
            @Override
            public Component prepareRenderer(TableCellRenderer renderer, int row, int column)
            {
                Component c = super.prepareRenderer(renderer, row, column);
                //if ((this.getValueAt(row, 5)).toString().equals("0"))
                //{
                    //      c.setBackground(Color.red);
                    // }
                //c.setBackground(Color.yellow);
                return c;
            }
        };
        jPanel2 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jxTabViewtDetails = new mnstudent.global.MyTable();
        jpanFuntionalDetails = new javax.swing.JPanel();
        jxBtnReview = new org.jdesktop.swingx.JXButton();
        jxBtnCancel = new org.jdesktop.swingx.JXButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jPanSearch = new javax.swing.JPanel();
        jxLbMajor = new org.jdesktop.swingx.JXLabel();
        jxCmbMajor = new org.jdesktop.swingx.JXComboBox();
        jxCmbFaculty = new org.jdesktop.swingx.JXComboBox();
        jxLbFaculty = new org.jdesktop.swingx.JXLabel();
        jxPanSearchDetails = new org.jdesktop.swingx.JXPanel();
        jChkSearchByID = new javax.swing.JCheckBox();
        jChkSearchByName = new javax.swing.JCheckBox();
        jChkSearch = new javax.swing.JCheckBox();
        jxLbCondition = new org.jdesktop.swingx.JXLabel();
        jxCmbCondition = new org.jdesktop.swingx.JXComboBox();
        jxpanHeader = new org.jdesktop.swingx.JXPanel();
        jxpanTitleHeader = new org.jdesktop.swingx.JXPanel();
        jXLabel5 = new org.jdesktop.swingx.JXLabel();
        jxpanInfoHeader = new org.jdesktop.swingx.JXPanel();
        jxpanInfo = new org.jdesktop.swingx.JXPanel();
        jXLabel2 = new org.jdesktop.swingx.JXLabel();
        jXLabel3 = new org.jdesktop.swingx.JXLabel();
        jXLabel6 = new org.jdesktop.swingx.JXLabel();
        jXLabel7 = new org.jdesktop.swingx.JXLabel();

        setLayout(new java.awt.BorderLayout());

        jxpanDetails.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jxpanDetails.setLayout(new java.awt.BorderLayout());

        jpanTableDetails.setLayout(new java.awt.BorderLayout());

        jpanContent.setLayout(new java.awt.BorderLayout());

        jxpanFindNavibar.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jxpanFindNavibar.setPreferredSize(new java.awt.Dimension(914, 30));

        jxSearchStudents.setToolTipText("Nhập mã số sinh viên");
        jxSearchStudents.addCaretListener(new javax.swing.event.CaretListener() {
            public void caretUpdate(javax.swing.event.CaretEvent evt) {
                jxSearchStudentsCaretUpdate(evt);
            }
        });

        jxLbSearch.setText("Tìm kiếm:");

        jxCmbAcademicYear.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jxCmbAcademicYearItemStateChanged(evt);
            }
        });

        jxCmbSemester.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jxCmbSemesterItemStateChanged(evt);
            }
        });

        jxLbSemester.setText("Học kỳ");

        jxLabAcademicYear.setText("Năm học");

        javax.swing.GroupLayout jxpanFindNavibarLayout = new javax.swing.GroupLayout(jxpanFindNavibar);
        jxpanFindNavibar.setLayout(jxpanFindNavibarLayout);
        jxpanFindNavibarLayout.setHorizontalGroup(
            jxpanFindNavibarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jxpanFindNavibarLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jxLbSemester, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(jxCmbSemester, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(67, 67, 67)
                .addComponent(jxLabAcademicYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(28, 28, 28)
                .addComponent(jxCmbAcademicYear, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
                .addComponent(jxLbSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jxSearchStudents, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jxpanFindNavibarLayout.setVerticalGroup(
            jxpanFindNavibarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jxpanFindNavibarLayout.createSequentialGroup()
                .addGroup(jxpanFindNavibarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jxSearchStudents, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxLbSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxCmbAcademicYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxCmbSemester, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxLbSemester, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxLabAcademicYear, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jpanContent.add(jxpanFindNavibar, java.awt.BorderLayout.NORTH);

        jPanel1.setLayout(new java.awt.BorderLayout());

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Danh sách sinh viên"));
        jPanel3.setLayout(new java.awt.BorderLayout());

        jxtabDetails.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã số sinh viên", "Tên sinh viên", "Tổng tiền học phí", "Số tiền đã đóng", "Còn lại"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane.setViewportView(jxtabDetails);
        if (jxtabDetails.getColumnModel().getColumnCount() > 0) {
            jxtabDetails.getColumnModel().getColumn(0).setResizable(false);
            jxtabDetails.getColumnModel().getColumn(1).setResizable(false);
            jxtabDetails.getColumnModel().getColumn(2).setResizable(false);
            jxtabDetails.getColumnModel().getColumn(3).setResizable(false);
            jxtabDetails.getColumnModel().getColumn(4).setResizable(false);
        }

        jPanel3.add(jScrollPane, java.awt.BorderLayout.CENTER);

        jPanel1.add(jPanel3, java.awt.BorderLayout.CENTER);

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Thông tin đóng học phí"));

        jxTabViewtDetails.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "STT", "Lần đóng", "Số tiền"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.Integer.class, java.lang.Float.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(jxTabViewtDetails);
        if (jxTabViewtDetails.getColumnModel().getColumnCount() > 0) {
            jxTabViewtDetails.getColumnModel().getColumn(0).setResizable(false);
            jxTabViewtDetails.getColumnModel().getColumn(1).setResizable(false);
            jxTabViewtDetails.getColumnModel().getColumn(2).setResizable(false);
        }

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 832, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );

        jPanel1.add(jPanel2, java.awt.BorderLayout.SOUTH);

        jpanContent.add(jPanel1, java.awt.BorderLayout.CENTER);

        jpanTableDetails.add(jpanContent, java.awt.BorderLayout.CENTER);

        jpanFuntionalDetails.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT, 10, 10));

        jxBtnReview.setText("Xuất báo cáo");
        jxBtnReview.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxBtnReviewActionPerformed(evt);
            }
        });
        jpanFuntionalDetails.add(jxBtnReview);

        jxBtnCancel.setText("Hủy bỏ");
        jxBtnCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jxBtnCancelActionPerformed(evt);
            }
        });
        jpanFuntionalDetails.add(jxBtnCancel);

        jpanTableDetails.add(jpanFuntionalDetails, java.awt.BorderLayout.PAGE_END);

        jxLbMajor.setText("Ngành");

        jxCmbMajor.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jxCmbMajorItemStateChanged(evt);
            }
        });

        jxCmbFaculty.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                jxCmbFacultyItemStateChanged(evt);
            }
        });

        jxLbFaculty.setText("Khoa");

        jxPanSearchDetails.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Chọn nội dung tìm kiếm", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION));

        btnGrp.add(jChkSearchByID);
        jChkSearchByID.setSelected(true);
        jChkSearchByID.setText("Tìm theo mã số sinh viên");

        btnGrp.add(jChkSearchByName);
        jChkSearchByName.setText("Tìm theo tên sinh viên");

        jChkSearch.setText("Tìm kiếm nhanh");

        javax.swing.GroupLayout jxPanSearchDetailsLayout = new javax.swing.GroupLayout(jxPanSearchDetails);
        jxPanSearchDetails.setLayout(jxPanSearchDetailsLayout);
        jxPanSearchDetailsLayout.setHorizontalGroup(
            jxPanSearchDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jxPanSearchDetailsLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(jxPanSearchDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jChkSearchByID)
                    .addComponent(jChkSearchByName))
                .addContainerGap(124, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jxPanSearchDetailsLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jChkSearch)
                .addGap(23, 23, 23))
        );
        jxPanSearchDetailsLayout.setVerticalGroup(
            jxPanSearchDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jxPanSearchDetailsLayout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addComponent(jChkSearchByID)
                .addGap(10, 10, 10)
                .addComponent(jChkSearchByName)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addComponent(jChkSearch)
                .addContainerGap())
        );

        jxLbCondition.setText("Điều kiện lọc");

        jxCmbCondition.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Môn học có sinh viên đăng ký", "Môn học không có sinh viên đăng ký", "Tất cả..." }));
        jxCmbCondition.setSelectedIndex(2);

        javax.swing.GroupLayout jPanSearchLayout = new javax.swing.GroupLayout(jPanSearch);
        jPanSearch.setLayout(jPanSearchLayout);
        jPanSearchLayout.setHorizontalGroup(
            jPanSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanSearchLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(jPanSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jxLbMajor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxLbFaculty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxLbCondition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jxCmbMajor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jxCmbFaculty, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jxCmbCondition, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 164, Short.MAX_VALUE))
                .addGap(23, 23, 23))
            .addComponent(jxPanSearchDetails, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanSearchLayout.setVerticalGroup(
            jPanSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanSearchLayout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(jPanSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jxCmbFaculty, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jxLbFaculty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(27, 27, 27)
                .addGroup(jPanSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jxLbMajor, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxCmbMajor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(25, 25, 25)
                .addGroup(jPanSearchLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jxLbCondition, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jxCmbCondition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addComponent(jxPanSearchDetails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jScrollPane1.setViewportView(jPanSearch);

        jpanTableDetails.add(jScrollPane1, java.awt.BorderLayout.LINE_START);

        jxpanDetails.add(jpanTableDetails, java.awt.BorderLayout.CENTER);

        add(jxpanDetails, java.awt.BorderLayout.CENTER);

        jxpanHeader.setLayout(new java.awt.BorderLayout());

        jxpanTitleHeader.setBorder(new org.jdesktop.swingx.border.DropShadowBorder());

        jXLabel5.setForeground(new java.awt.Color(0, 102, 255));
        jXLabel5.setText("TÌNH TRẠNG ĐÓNG HỌC PHÍ");
        jXLabel5.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
        jxpanTitleHeader.add(jXLabel5);

        jxpanHeader.add(jxpanTitleHeader, java.awt.BorderLayout.PAGE_START);

        jxpanInfoHeader.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jxpanInfoHeader.setLayout(new java.awt.BorderLayout());

        jxpanInfo.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "THÔNG TIN", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP));

        jXLabel2.setText("Ngày lập");

        jXLabel3.setForeground(new java.awt.Color(255, 51, 51));
        jXLabel3.setText("01/06/2014");

        jXLabel6.setText("Nhân viên");

        jXLabel7.setForeground(new java.awt.Color(255, 51, 51));
        jXLabel7.setText("Lê Đức Sang");

        javax.swing.GroupLayout jxpanInfoLayout = new javax.swing.GroupLayout(jxpanInfo);
        jxpanInfo.setLayout(jxpanInfoLayout);
        jxpanInfoLayout.setHorizontalGroup(
            jxpanInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jxpanInfoLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addComponent(jXLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jXLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 259, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 431, Short.MAX_VALUE)
                .addComponent(jXLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(jXLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(185, Short.MAX_VALUE))
        );
        jxpanInfoLayout.setVerticalGroup(
            jxpanInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jxpanInfoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jxpanInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jXLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jXLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jXLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jXLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jxpanInfoHeader.add(jxpanInfo, java.awt.BorderLayout.CENTER);

        jxpanHeader.add(jxpanInfoHeader, java.awt.BorderLayout.CENTER);

        add(jxpanHeader, java.awt.BorderLayout.NORTH);
    }// </editor-fold>//GEN-END:initComponents

    private void jxBtnReviewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxBtnReviewActionPerformed
        
    }//GEN-LAST:event_jxBtnReviewActionPerformed

    private void jxBtnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jxBtnCancelActionPerformed
       
    }//GEN-LAST:event_jxBtnCancelActionPerformed
    
    private void jxCmbFacultyItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jxCmbFacultyItemStateChanged
        //
        m_listMajorObj = new ArrayList<MajorDTO>();
        m_objMajor = new MajorDTO("", "Tất cả...");
        m_listMajorObj.add(m_objMajor);
        m_listMajorObj.addAll(m_MajorBLL.getAllMajorByFacultyIDToArray(((FacultyDTO)evt.getItem()).getFacultyID()));
        jxCmbMajor.setModel(new DefaultComboBoxModel(m_listMajorObj.toArray()));
        //
        updateDataTable(jxSearchStudents.getText());
        //
    }//GEN-LAST:event_jxCmbFacultyItemStateChanged

    private void jxCmbMajorItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jxCmbMajorItemStateChanged
        updateDataTable(jxSearchStudents.getText());
    }//GEN-LAST:event_jxCmbMajorItemStateChanged

    private void jxSearchStudentsCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_jxSearchStudentsCaretUpdate
        //
        updateDataTable(((JXSearchField)evt.getSource()).getText());
    }//GEN-LAST:event_jxSearchStudentsCaretUpdate

    private void jxCmbSemesterItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jxCmbSemesterItemStateChanged
        //
        updateDataTable(jxSearchStudents.getText());
    }//GEN-LAST:event_jxCmbSemesterItemStateChanged

    private void jxCmbAcademicYearItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jxCmbAcademicYearItemStateChanged
        //
        updateDataTable(jxSearchStudents.getText());
    }//GEN-LAST:event_jxCmbAcademicYearItemStateChanged

    private void updateDataTable(String _strValue){
        m_value = new ArrayList<>();
        if(jChkSearchByID.isSelected())
            m_value.add(_strValue);
        else
            m_value.add("");
        if(jChkSearchByName.isSelected())
            m_value.add(_strValue);
        else
            m_value.add("");
        if(((FacultyDTO)jxCmbFaculty.getSelectedItem()).getNameOfFaculty().equals("Tất cả..."))
            m_value.add("");
        else
            m_value.add(((FacultyDTO)jxCmbFaculty.getSelectedItem()).getNameOfFaculty());
        if(((MajorDTO)jxCmbMajor.getSelectedItem()).getNameOfMajor().equals("Tất cả..."))
            m_value.add("");
        else
            m_value.add(((MajorDTO)jxCmbMajor.getSelectedItem()).getNameOfMajor());
        if(((SemesterDTO)jxCmbSemester.getSelectedItem()).getNameOfSemester().equals("Tất cả..."))
            m_value.add("");
        else
            m_value.add(((SemesterDTO)jxCmbSemester.getSelectedItem()).getNameOfSemester());
        if(((AcademicYearDTO)jxCmbAcademicYear.getSelectedItem()).getNameOfAcademicYear().equals("Tất cả..."))
            m_value.add("");
        else
            m_value.add(((AcademicYearDTO)jxCmbAcademicYear.getSelectedItem()).getNameOfAcademicYear());
        //Fill data into JXTable
        //((DefaultTableModel)jxtabDetails.getModel()).getDataVector().removeAllElements();
        //DefaultTableModel m_Model = (DefaultTableModel) jxtabDetails.getModel();
        m_Model.getDataVector().removeAllElements();
        m_Model.fireTableDataChanged();
        //m_Model.fireTableStructureChanged();
        DataTable.addRow(m_StudentBLL.getRegistrationCoursesInforOfStudent(m_value.toArray()), m_Model);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup btnGrp;
    private javax.swing.JCheckBox jChkSearch;
    private javax.swing.JCheckBox jChkSearchByID;
    private javax.swing.JCheckBox jChkSearchByName;
    private javax.swing.JPanel jPanSearch;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private org.jdesktop.swingx.JXLabel jXLabel2;
    private org.jdesktop.swingx.JXLabel jXLabel3;
    private org.jdesktop.swingx.JXLabel jXLabel5;
    private org.jdesktop.swingx.JXLabel jXLabel6;
    private org.jdesktop.swingx.JXLabel jXLabel7;
    private javax.swing.JPanel jpanContent;
    private javax.swing.JPanel jpanFuntionalDetails;
    private javax.swing.JPanel jpanTableDetails;
    private org.jdesktop.swingx.JXButton jxBtnCancel;
    private org.jdesktop.swingx.JXButton jxBtnReview;
    private org.jdesktop.swingx.JXComboBox jxCmbAcademicYear;
    private org.jdesktop.swingx.JXComboBox jxCmbCondition;
    private org.jdesktop.swingx.JXComboBox jxCmbFaculty;
    private org.jdesktop.swingx.JXComboBox jxCmbMajor;
    private org.jdesktop.swingx.JXComboBox jxCmbSemester;
    private org.jdesktop.swingx.JXLabel jxLabAcademicYear;
    private org.jdesktop.swingx.JXLabel jxLbCondition;
    private org.jdesktop.swingx.JXLabel jxLbFaculty;
    private org.jdesktop.swingx.JXLabel jxLbMajor;
    private org.jdesktop.swingx.JXLabel jxLbSearch;
    private org.jdesktop.swingx.JXLabel jxLbSemester;
    private org.jdesktop.swingx.JXPanel jxPanSearchDetails;
    private org.jdesktop.swingx.JXSearchField jxSearchStudents;
    private mnstudent.global.MyTable jxTabViewtDetails;
    private org.jdesktop.swingx.JXPanel jxpanDetails;
    private org.jdesktop.swingx.JXPanel jxpanFindNavibar;
    private org.jdesktop.swingx.JXPanel jxpanHeader;
    private org.jdesktop.swingx.JXPanel jxpanInfo;
    private org.jdesktop.swingx.JXPanel jxpanInfoHeader;
    private org.jdesktop.swingx.JXPanel jxpanTitleHeader;
    private mnstudent.global.MyTable jxtabDetails;
    // End of variables declaration//GEN-END:variables
}
